//
//  ProtocolTransformType.m
//  etionCBLogic
//
//  Created by wjxfhxy on 1/23/14.
//  Copyright (c) 2014 GuangZhouXuanWu. All rights reserved.
//

#import "ProtocolTransformType.h"

@implementation CProtocolTransformType

static NSMutableDictionary *s_dicTransformType;

+(void)addTransformType:(EProtocolTransformType)type commandIDs:(NSInteger)IDs,... 
{
    if(s_dicTransformType==nil)
        s_dicTransformType=[NSMutableDictionary new];
    
    va_list args;
    va_start(args, IDs);
    for(NSInteger i=IDs;i!=0;i=va_arg(args, NSInteger))
    {
        [s_dicTransformType setObject:[NSNumber numberWithUnsignedInt:type] forKey:[[NSNumber numberWithInteger:i] stringValue]];
    }
    va_end(args);
}

+(EProtocolTransformType)getTransformType:(NSInteger)ID
{
    EProtocolTransformType type=EProtocolTransformTypeSocketStream;
    type=[[s_dicTransformType objectForKey:[[NSNumber numberWithInteger:ID] stringValue]] unsignedIntegerValue];
    return type;
}

static NSString*(^HTTPSRESTUserNumber)() = NULL;

+(void)setHTTPSRESTUserNumber:(NSString*(^)())userNumber
{
    if(HTTPSRESTUserNumber != NULL)
        Block_release(HTTPSRESTUserNumber);
    
    HTTPSRESTUserNumber = Block_copy(userNumber);
}

+(NSString*)getHTTPSRESTUserNumber
{
    if(HTTPSRESTUserNumber == NULL)
        return @"";
    
    return HTTPSRESTUserNumber();
}

@end
